// 判断元素是否存在

#include <iostream>
using namespace std;

bool judge(long long k, long long x)
{
    if(x == k)
        return true;
    else if(k > 100000)
        return false;
    
    return judge(2*k+1, x)||judge(3*k+1,x);
}

int main(void)
{
    long long k, x; 
    scanf("%lld,%lld", &k, &x);
    
    if(judge(k, x))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
